package system;

import cn.hutool.core.io.FileUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;

import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class DataReader {

    public List<Map<String,Object>> readDatas(){
        ExcelReader reader= ExcelUtil.getReader(FileUtil.file("E:\\考试编排\\段考一考号编排.xls"), "段考一考号编排");
        List<Map<String,Object>> readAll = reader.readAll();
        return readAll;
    }

    public static void main(String[] args) {
        List<Map<String,Object>> datas=new DataReader().readDatas();
        int shengwu=0;
        int dili=0;
        int huaxue=0;
        int zhengzhi=0;
        Iterator<Map<String,Object>> iterator=datas.iterator();
        while(iterator.hasNext()){
            Map<String,Object> data=iterator.next();
            String type= (String) data.get("类型");
            if(type.indexOf("生")!=-1){
                shengwu++;
            }
            if(type.indexOf("地")!=-1){
                dili++;
            }
            if(type.indexOf("化")!=-1){
                huaxue++;
            }
            if(type.indexOf("政")!=-1){
                zhengzhi++;
            }
        }
        System.out.println("选科生物："+shengwu+"人、地理："+dili+"人、化学："+huaxue
                +"人、政治："+zhengzhi+"人");

        BianPai.ysywl(datas);
//        BianPai.shengwu(datas);
//        BianPai.dili(datas);
//        BianPai.huaxue(datas);
//        BianPai.zhengzhi(datas);
    }
}
